'use strict';

module.exports = {
  success(data) {
    if (this.session && this.session.account) {
      this.session = Object.assign({}, this.session);
    }

    this.body = {
      errMessage: null,
      errCode: null,
      data,
    };
    this.status = 201;
  },

  fail(data) {
    this.body = {
      errMessage: data,
      errCode: 400,
    };
    this.status = 400;
  },

  error(err) {
    this.logger.error(err);

    this.body = {
      errMessage: err,
      errCode: 500,
      data: {},
    };
    this.status = 500;
  },
};
